package main

import "fmt"
import "time"
import "path"
import "reflect"
import "unsafe"
import "runtime"
import "bytes"


var  con   chan int =make(chan int,1) 

var mapA = make(map[string]string,20)

var dateT = time.NewTimer(time.Second)

func doSomething(){
   for {
     select {
             case a1:= <-con :
            fmt.Println(a1)
          fmt.Println( time.Now())
           

          case <- dateT.C :
              fmt.Println("time outside")
              dateT.Reset(time.Second)
              
             
     }
   }
}

type A struct{
  T1 int
};

type B struct{
  A
  T2 int
};

type C interface{
	Ss1()
};

func (a *A)Ss1(){
  fmt.Println("func")

}


func init(){
   fmt.Println("strudy")
}


func start(){
   fmt.Println(printMyName())
   fmt.Println("start")
}

func printMyName() string {
 pc, _, _, _ := runtime.Caller(1)
 return runtime.FuncForPC(pc).Name()
}


type Sding int

const ( qtm = 3 ; safd =4;)


func main(){
    var p1 int= 1

    byteIn :=     bytes.NewBuffer([]byte(""))

    byteIn.Write([]byte("jiangyibo"))

    fmt.Println(byteIn)

    f :=    reflect.ValueOf(start)

    fmt.Println(safd)

    var canshu []reflect.Value = make([]reflect.Value,0)

    f.Call(canshu )

    fmt.Println(unsafe.Pointer(&p1))

    fmt.Println(uintptr(unsafe.Pointer(&p1)))

    fmt.Println(unsafe.Pointer(uintptr(0)))
    
    fmt.Println(path.Dir(""))
    mapA["jiang"]="bobo"
    b := B{}
    b.T1 = 1
    b.Ss1()
    go    doSomething()
    con <- 1
    time.Sleep(10000000000)
    fmt.Println("ok")
}


